package com.ny.wlw;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class Test01 {
    public static void main(String[] args) throws IOException {
        String data="劳动节快乐";

        FileOutputStream outputStream=new FileOutputStream("1.txt");
        FileInputStream inputStream=new FileInputStream("1.text");
        byte[] bytes=data.getBytes();
        outputStream.write(bytes);
        inputStream.read(bytes);
        byte[]buffer=new byte[1024];
        StringBuilder conten=new StringBuilder();
        int length;
        while ((length= inputStream.read(buffer))!=-1){
            conten.append(new  String(buffer,0,length,StandardCharsets.UTF_8));
        }System.out.printf(conten.toString());
    }
}
